package com.dlc.shop.user.platform.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.common.config.Constant;
import com.dlc.shop.common.response.ServerResponseEntity;
import com.dlc.shop.common.util.PageParam;
import com.dlc.shop.user.common.model.UserGrowthLog;
import com.dlc.shop.user.common.service.UserGrowthLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户成长值记录
 *
 * @author LGH
 * @date 2020-02-26 16:03:14
 */
@Tag(name = "用户成长值记录")
@RestController
@AllArgsConstructor
@RequestMapping("/user/userGrowthLog" )
public class UserGrowthLogController {

    private final UserGrowthLogService userGrowthLogService;

    /**
     * 获取某个用户的成长值记录
     */
    @GetMapping("/pageByUserId" )
    @Operation(summary = "分页" , description = "分页")
    @PreAuthorize("@pms.hasPermission('user:userGrowthLog:page')" )
    public ServerResponseEntity<IPage<UserGrowthLog>> getPageByUserId(PageParam<UserGrowthLog> page, String userId) {
        IPage<UserGrowthLog> resPage = userGrowthLogService.getPageByUserId(page, Constant.PLATFORM_SHOP_ID, userId);
        return ServerResponseEntity.success(resPage);
    }
}
